package com.lineage.data.item_etcitem;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_DelSkill;
import com.lineage.server.serverpackets.ServerBasePacket;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ChangClassid extends ItemExecutor {
  private int a;
  
  private static final Log _log = LogFactory.getLog(ChangClassid.class);
  
  public static ItemExecutor get() {
    return new ChangClassid();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    pc.sendPackets(
        (ServerBasePacket)new S_DelSkill(pc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
    Iterator<L1ItemInstance> iterator2 = pc.getInventory().getItems().iterator();
    while (iterator2.hasNext()) {
      L1ItemInstance item2 = iterator2.next();
      pc.getInventory().setEquipped(item2, false, false, false);
      pc.setClassId(this.a);
      pc.setTempCharGfx(this.a);
      pc.setGfxId(this.a);
      pc.setElfAttr(0);
      try {
        pc.save();
      } catch (Exception e) {
        e.printStackTrace();
      } 
    } 
  }
  
  public void set_set(String[] set) {
    this.a = Integer.parseInt(set[1]);
  }
}
